<%--
  Created by IntelliJ IDEA.
  User: CBo
  Date: 2025/8/18
  Time: 19:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <title>市场招生管理系统-登录</title>
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/bootstrap.min.css"/>">
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/bootstrap-icons.min.css"/>">
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/animate.min.css"/>"/>
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/reset.css"/>">
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/common.css"/> ">
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/base.css"/>">
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/login.css"/>">
</head>

<body>
<!-- 显示错误信息 -->
<%
    String errorMessage = (String) session.getAttribute("errorMessage");
    if (errorMessage != null) {
%>
<script>
    alert("<%= errorMessage %>");
</script>
<%
        session.removeAttribute("errorMessage"); // 显示后清除
    }
%>
<div class="app">
    <header class="header">
        <div class="container flex-row flex-align-center">
            <!-- 移动端展示的面包导航 -->
            <!-- <div class="header-hamburger d-md-none">
            <i class="bi bi-list f36"></i>
        </div> -->
            <!-- logo -->
            <div class="header-logo">
                <a href="#">
                    <img class="d-none d-md-block" src="<c:url value="/images/logo_pc.png"/>" alt="logo">
                    <img class="d-block d-md-none" src="<c:url value="/images/logo_mobile.png"/>" alt="logo">
                </a>
                <h1>考试管理系统</h1>
            </div>
        </div>
    </header>
    <div class="content">
        <div class="container pos-relative">
            <div class="registry-form">
                <div class="registry-form-head">
                    <h3>用户登录</h3>
                </div>
                <form class="registry-form-body" action="login" method="post">
                    <div class="form-group mb-2">
                        <label for="">用户名</label>
                        <input type="tel" name="phone" class="form-control" placeholder="请输入你的用户名">
                    </div>
                    <div class="form-group mb-2">
                        <label for="">密码</label>
                        <div class="form-password">
                            <input type="password" name="pwd" class="form-control" placeholder="请输入你的密码">
                        </div>
                    </div>
                    <div class="form-group mb-3">
                        <label for="userCaptcha">验证码</label>
                        <div class="captcha-wrapper">
                            <input type="text" id="userCaptcha" name="userCaptcha" class="form-control">
                            <div class="captcha-img">
                                <!--src 向CaptchaServlet 发送get请求 生成验证码图片-->
                                <img class="captcha" id="captchaImg" src="captcha" alt="验证码"
                                     onclick="refreshCaptcha()"
                                     style="cursor: pointer; vertical-align: middle;" title="点击刷新">
                                <a href="javascript:void(0)" onclick="refreshCaptcha()">看不清？换一张</a>
                            </div>
                        </div>
                    </div>
                    <div class="form-group mb-3">

                        <a class="btn-link" href="register">没有账号？去注册</a>
                    </div>
                    <div class="form-group mb-3">
                        <button class="btn btn-primary btn-block w-100">登录</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    // 刷新验证码
    function refreshCaptcha() {
        // 通过添加时间戳参数防止浏览器缓存
        document.getElementById("captchaImg").src = "captcha?t=" + new Date().getTime();
    }
</script>
</body>

</html>

